export function initRes(list, req, reqParam, cb) {
  if (list && list.length > 0) {
    return
  }
  req(reqParam)
    .then(res => {
      if (cb instanceof Function) {
        cb(res)
      }
    })
    .catch(error => {
      console.error(error)
    })
}

export function initResCb(list, req, reqParam, cb) {
  if (list && list.length > 0) {
    if (cb instanceof Function) {
      cb(list)
    }
  }
  req(reqParam)
    .then(res => {
      if (cb instanceof Function) {
        list = res.data.data
        cb(list)
      }
    })
    .catch(error => {
      console.error(error)
    })
}
